package com.shop.entity;

import java.io.Serializable;
import java.util.Objects;

//购物车表
public class ShoppingCart implements Serializable {
    private int sc_id;              //购物车id
    private int u_id;             //用户名id(user外键)
    private double sc_num;             //购物车商品总金额

    public ShoppingCart() {
    }

    public ShoppingCart(int sc_id, int u_id, double sc_num) {
        this.sc_id = sc_id;
        this.u_id = u_id;
        this.sc_num = sc_num;
    }

    public int getSc_id() {
        return sc_id;
    }

    public void setSc_id(int sc_id) {
        this.sc_id = sc_id;
    }

    public int getU_id() {
        return u_id;
    }

    public void setU_id(int u_id) {
        this.u_id = u_id;
    }

    public double getSc_num() {
        return sc_num;
    }

    public void setSc_num(double sc_num) {
        this.sc_num = sc_num;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        ShoppingCart that = (ShoppingCart) o;
        return sc_id == that.sc_id &&
                u_id == that.u_id &&
                Double.compare(that.sc_num, sc_num) == 0;
    }

    @Override
    public int hashCode() {
        return Objects.hash(sc_id, u_id, sc_num);
    }

    @Override
    public String toString() {
        return "ShoppingCart{" +
                "sc_id=" + sc_id +
                ", u_id=" + u_id +
                ", sc_num=" + sc_num +
                '}';
    }
}
